# Maintainer: Bruno Pagani <archange@archlinux.org>

_pkg=spyder-kernels
pkgname=python-${_pkg}
pkgver=2.4.4
pkgrel=1
pkgdesc="Jupyter Kernels for the Spyder console"
arch=(any)
url="https://github.com/spyder-ide/spyder-kernels/"
license=(MIT)
makedepends=(python python-setuptools)
depends=(
    cython
    ipython
    python-cloudpickle
    python-ipykernel
    python-jupyter_client
    python-matplotlib
    python-pandas
    python-pyzmq
    python-wurlitzer
)
checkdepends=(
    python-dask
    python-distributed
    python-django
    python-flaky
    python-numpy
    python-pillow
    python-pytest
    python-scipy
    python-xarray
)
# No tests in pypi tarballs
#source=(https://files.pythonhosted.org/packages/source/${_pkg::1}/${_pkg}/${_pkg}-${pkgver}.tar.gz)
source=(${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha256sums=('a022f219073b1ffe8fa48c9234574fbfbb217aae81267ae6ad237b09852d9658')

prepare() {
  cd ${_pkg}-${pkgver}
  sed -i 's|ipykernel>=6.16.1,<7|ipykernel>=6.16.1|' setup.py
  sed -i 's|ipython>=7.31.1,<9|ipython>=7.31.1|' setup.py
  sed -i 's|jupyter-client>=7.4.9,<8|jupyter-client>=7.4.9|' setup.py
}

build() {
  cd ${_pkg}-${pkgver}
  python setup.py build
}

check() {
  cd ${_pkg}-${pkgver}
  pytest -vv --color=yes spyder_kernels
}

package() {
  cd ${_pkg}-${pkgver}
  python setup.py install --prefix=/usr --root="${pkgdir}" --optimize=1 --skip-build
  install -Dm644 LICENSE.txt -t "${pkgdir}"/usr/share/licenses/${pkgname}/
}
